<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="box"></div>
    <script>
      const box = document.getElementById("box");

      const ps = new DocumentFragment();
      for (let index = 0; index < 10; index++) {
        const p = document.createElement("p");
        p.innerHTML = "new P " + index;
        ps.append(p);
      }

      box.append(ps);

      // box.append(p1);
      // box.append(p2);
      // box.append(p3);
    </script>
  </body>
</html>
